<?php defined('SYSPATH') or die('No direct script access.');
/*
 * jQuery File Upload Plugin PHP Example 5.2.7
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://creativecommons.org/licenses/MIT/
 */

class Image_Output
{
    function __construct() {
    }

	static function write($image_filename)
	{
		if (file_exists($image_filename) AND is_file($image_filename))
		{
			$size = getimagesize($image_filename);
			$fp = fopen($image_filename, "rb");
			if ($size && $fp) {
				header("Content-type: {$size['mime']}");
				header('Expires:' . gmdate('D, d M Y H:i:s', time() + 2592000) . ' GMT');
				header ("Cache-Control: max-age=2592000"); 
				fpassthru($fp);
				exit;
			} 
		}
		header("Status: 500 服务端文件不存在");
	}
			
}
